package dinucleotides;

import javax.swing.table.AbstractTableModel;

@SuppressWarnings("serial")
class CustomTableModel extends AbstractTableModel {
	
	private String[] columnsNames = {"l","1","2","3","4","5","6"};
	private String[][] data;
	
	CustomTableModel(String tabName) {
		this.data = new String[1][Main.getGenerateur().getNbPaires() + 1];
		this.data[0][0] = tabName;
		for (int i=1; i<this.data[0].length;i++) {
			this.data[0][i] = "";
		}
	}

	@Override
	public int getColumnCount() {
		return this.columnsNames.length;
	}
	
	@Override
	public int getRowCount() {
		return this.data.length;
	}
	
	@Override
	public Object getValueAt(int row, int col) {
		return this.data[row][col];
	}

	@Override
	public boolean isCellEditable(int row, int col) {
		return false;
	}
	
	public void setValueAt(String value, int row, int col) {
		this.data[row][col] = value;
		this.fireTableDataChanged();
	}
	public String getColumnName(int col) {
		return columnsNames[col];
	}
}